/*
{
  "code": null,
  "msg": null,
  "data": {
    "records": [
      {
        "id": "1",
        "name": "日报管理系统小组",
        "createTime": 1705334400000,
        "leader": "1",
        "person": "1,2,3"
      }
    ],
    "total": 1,
    "size": 10,
    "current": 1,
    "orders": [],
    "optimizeCountSql": true,
    "hitCount": false,
    "countId": null,
    "maxLimit": null,
    "searchCount": true,
    "pages": 1
  },
  "map": {
    "leaders": [
      {
        "id": "1",
        "name": "林昊宇",
        "role": null,
        "email": null
      }
    ]
  }
}
 */
// 查询列表接口
const getProjectPage = (params) => {
  return $axios({
    url: '/project',
    method: 'get',
    params
  })
}

// 按条件查询接口
function findByConditionJS(params){
  if (params.dateValue !== null){
    let date = new Date(params.dateValue);
    params.dateValue = date.toDateString();
  }
  return $axios({
    url: '/project',
    method: 'get',
    params
  })
}


/*
{
  "code": 1,
  "msg": null,
  "data": [
    {
      "id": "1745337348209553410",
      "schedule": "微服务治理",
      "duration": 5,
      "rate": 90,
      "userId": "1",
      "dailyId": "1745337348012421121",
      "projectId": "1"
    },
    {
      "id": "11",
      "schedule": "系统开发设计",
      "duration": 7,
      "rate": 25,
      "userId": null,
      "dailyId": "11",
      "projectId": "1"
    },
    {
      "id": "1745337348998082562",
      "schedule": "docker",
      "duration": 7,
      "rate": 90,
      "userId": "1",
      "dailyId": "1745337348930973697",
      "projectId": "2"
    }
  ],
  "map": {
    "project": [
      {
        "id": "1",
        "name": "日报管理系统小组",
        "createTime": 1705334400000,
        "leader": "1",
        "person": "1,2,3"
      },
      {
        "id": "2",
        "name": "测试项目组1",
        "createTime": 1706544000000,
        "leader": "2",
        "person": "1,2,3"
      }
    ],
    "info": [
      {
        "title": null,
        "content": null,
        "schedule": null,
        "duration": null,
        "rate": null,
        "file": null,
        "belongTime": null,
        "projectLeader": "林昊宇",
        "projectName": "日报管理系统小组",
        "projectId": "1"
      },
      {
        "title": null,
        "content": null,
        "schedule": null,
        "duration": null,
        "rate": null,
        "file": null,
        "belongTime": null,
        "projectLeader": "孙睿",
        "projectName": "测试项目组1",
        "projectId": "2"
      }
    ]
  }
}
 */
const getScheme = (params) => {
  return $axios({
    url: '/scheme',
    method: 'get',
    params
  })
}

// 删除接口
const deleteDish = (ids) => {
  return $axios({
    url: '/dish',
    method: 'delete',
    params: { ids }
  })
}

// 修改接口
const editDish = (params) => {
  return $axios({
    url: '/dish',
    method: 'put',
    data: { ...params }
  })
}

// 新增接口
const addDish = (params) => {
  return $axios({
    url: '/dish',
    method: 'post',
    data: { ...params }
  })
}

// 查询详情
const queryDishById = (id) => {
  return $axios({
    url: `/dish/${id}`,
    method: 'get'
  })
}

// 获取菜品分类列表
const getCategoryList = (params) => {
  return $axios({
    url: '/category/list',
    method: 'get',
    params
  })
}

// 查菜品列表的接口
const queryDishList = (params) => {
  return $axios({
    url: '/dish/list',
    method: 'get',
    params
  })
}

// 文件down预览
const commonDownload = (params) => {
  return $axios({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    },
    url: '/common/download',
    method: 'get',
    params
  })
}
const addProject = (params) => {
  return $axios({
    url: '/project',
    method: 'post',
    data: { ...params }
  })
}
const queryMember = () => {
  return $axios({
    url: `/user`,
    method: 'get'
  })
}
// 起售停售---批量起售停售接口
const dishStatusByStatus = (params) => {
  return $axios({
    url: `/dish/status/${params.status}`,
    method: 'post',
    params: { ids: params.id }
  })
}